﻿Imports System.Data.SqlClient

Public Class objectsRptCOA
    Dim _accountGroup As String
    Dim _accountID As String
    Dim _accountName As String

    Public Property AccountGroup() As String
        Get
            Return _accountGroup
        End Get
        Set(ByVal value As String)
            _accountGroup = value
        End Set
    End Property

    Public Property AccountID() As String
        Get
            Return _accountID
        End Get
        Set(ByVal value As String)
            _accountID = value
        End Set
    End Property

    Public Property AccountName() As String
        Get
            Return _accountName
        End Get
        Set(ByVal value As String)
            _accountName = value
        End Set
    End Property
End Class

Public Class ListCOA
    Public Shared Function GetdsCOA(ByVal Comp As String) As DataSet
        Dim Var As New varDeclare
        Dim connection As SqlConnection
        Dim adapter As SqlDataAdapter
        Dim command As New SqlCommand
        Dim ds As New DataSet
        connection = New SqlConnection(Var.SUISConn)

        connection.Open()
        command.Connection = connection
        command.CommandType = CommandType.Text
        'command.CommandText = "SELECT GLGroup 'AccountGroup', GLId 'AccountID', GLName 'AccountName' FROM GLAccount WITH(NOLOCK) WHERE Comp = @CompID ORDER BY GLGROUP, GLID"
        command.CommandText = "Select GLAC_CODE_LEVEL 'AccountGroup', GLAC_CODE 'AccountID', GLAC_DESC 'AccountName' FROM  GL_ACCOUNT WITH(NOLOCK) WHERE  ISNULL(COMP_CODE,'01') = @CompID"
        command.Parameters.Add("@CompID", SqlDbType.VarChar).Value = Comp
        adapter = New SqlDataAdapter(command)
        adapter.Fill(ds)
        connection.Close()
        Return ds
    End Function
End Class
